import { CarType } from "@/api/interface/carType";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 产品模型接口
 */

// 分页查询产品模型
export const getProductModelPage = (params: CarType.ReqCarType) => {
  return http.post<CarType.ResCarTypeData>(PORT1 + `/product/category/page`, params);
};

// 添加产品模型
export const addProductModelAdd = (params: CarType.ResCarTypeData) => {
  return http.post(PORT1 + `/product/category/add`, params);
};

// 修改产品模型
export const updateProductModelUpdate = (params: CarType.ResCarTypeData) => {
  return http.post(PORT1 + `/product/category/update`, params);
};

// 删除产品模型
export const delProductModelDelete = (params: CarType.ReqCarType) => {
  return http.get(PORT1 + `/product/category/delete`, params);
};

// 查询全部产品模型
export const getProductModelList = (params?: any, other?: any) => {
  return http.get<CarType.ResCarTypeData>(PORT1 + `/product/category/list`, params, {
    ...other
  });
};
export const getProductModelAll = (params: CarType.ResCarTypeData) => {
  return http.post<CarType.ResCarTypeData>(PORT1 + `/product/category/all`, params);
};
// 查询产品模型
export const getProductModelDetail = (params: CarType.ResCarTypeData) => {
  return http.get<CarType.ResCarTypeData>(PORT1 + `/product/category/detail`, params);
};

// 根据id查询配件信息
export const partDetail = (params: CarType.ResCarTypeData) => {
  return http.get<CarType.ResCarTypeData>(PORT1 + `/product/category/part/detail`, params);
};

// 全部配件
export const getProductCategoryPartAll = (params: CarType.ResCarTypeData, other: any) => {
  return http.post(PORT1 + `/product/category/part/all`, params, {
    ...other
  });
};

//  配件新增
export const partAdd = (params: CarType.ResCarTypeData) => {
  return http.post(PORT1 + `/product/category/part/add`, params);
};

// 删除配件
export const partDelete = (params: CarType.ReqCarType) => {
  return http.get(PORT1 + `/product/category/part/delete`, params);
};
//  修改配件
export const partUpdate = (params: CarType.ResCarTypeData) => {
  return http.post(PORT1 + `/product/category/part/update`, params);
};
